package com.cdqidi.core.weixinmanager.domain;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * 微信用户信息
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
public class UserInfoDTO extends BaseQuery {

    @ExcelIgnore
    @JsonIgnore
    private static final String EXCEL_TITLE = "微信用户信息";
    /**
     * 主键
     */
    @ExcelProperty(value = {EXCEL_TITLE, "用户标识"})
    @NotBlank(message = "用户标识不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 100, message = "用户标识长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String openid;
    /**
     * 是否订阅该公众号
     */
    @ExcelProperty(value = {EXCEL_TITLE, "是否订阅该公众号"})
    private Integer subscribe;
    /**
     * 用户昵称
     */
    @ExcelProperty(value = {EXCEL_TITLE, "用户昵称"})
    @Size(max = 100, message = "用户昵称长度不能超过{max}位", groups = DefaultGroup.class)
    private String nickName;
    /**
     * 用户所在城市
     */
    @ExcelProperty(value = {EXCEL_TITLE, "用户所在城市"})
    @Size(max = 50, message = "用户所在城市长度不能超过{max}位", groups = DefaultGroup.class)
    private String city;
    /**
     * 用户所在国家
     */
    @ExcelProperty(value = {EXCEL_TITLE, "用户所在国家"})
    @Size(max = 50, message = "用户所在国家长度不能超过{max}位", groups = DefaultGroup.class)
    private String country;
    /**
     * 用户所在省份
     */
    @ExcelProperty(value = {EXCEL_TITLE, "用户所在省份"})
    @Size(max = 50, message = "用户所在省份长度不能超过{max}位", groups = DefaultGroup.class)
    private String province;
    /**
     * 用户语言
     */
    @ExcelProperty(value = {EXCEL_TITLE, "用户语言"})
    @Size(max = 50, message = "用户语言长度不能超过{max}位", groups = DefaultGroup.class)
    private String language;
    /**
     * 用户头像
     */
    @ExcelProperty(value = {EXCEL_TITLE, "用户头像"})
    @Size(max = 200, message = "用户头像长度不能超过{max}位", groups = DefaultGroup.class)
    private String headImgUrl;
    /**
     * 关注时间
     */
    @ExcelProperty(value = {EXCEL_TITLE, "关注时间"})
    private Long subscribeTime;
    /**
     * 全局唯一编号
     */
    @ExcelProperty(value = {EXCEL_TITLE, "全局唯一编号"})
    @Size(max = 100, message = "全局唯一编号长度不能超过{max}位", groups = DefaultGroup.class)
    private String unionId;
    /**
     * 用户所在分组id
     */
    @ExcelProperty(value = {EXCEL_TITLE, "用户所在分组id"})
    @Size(max = 200, message = "用户所在分组id长度不能超过{max}位", groups = DefaultGroup.class)
    private String groupId;
    /**
     * 状态
     */
    @ExcelProperty(value = {EXCEL_TITLE, "状态"})
    private Integer status;
    /**
     * 添加时间
     */
    @ExcelProperty(value = {EXCEL_TITLE, "添加时间"})
    @NotNull(message = "添加时间不能为空", groups = DefaultGroup.class)
    private LocalDateTime addTime;
    /**
     * 更新时间
     */
    @ExcelProperty(value = {EXCEL_TITLE, "更新时间"})
    private LocalDateTime updateTime;
    /**
     * 性别
     */
    @ExcelIgnore
    @NotBlank(message = "性别不能为空", groups = DefaultGroup.class)
    @Size(max = 20, message = "性别长度不能超过{max}位", groups = DefaultGroup.class)
    private String sex;
    /**
     * 性别显示
     */
    @ExcelProperty(value = {EXCEL_TITLE, "性别"})
    private String sexDisplay;
    /**
     * 是否关注
     */
    @ExcelIgnore
    @NotBlank(message = "是否关注不能为空", groups = DefaultGroup.class)
    @Size(max = 20, message = "是否关注长度不能超过{max}位", groups = DefaultGroup.class)
    private String sub;
    /**
     * 是否关注显示
     */
    @ExcelProperty(value = {EXCEL_TITLE, "是否关注"})
    private String subDisplay;
    /**
     * 公众号
     */
    @ExcelIgnore
    @NotBlank(message = "公众号不能为空", groups = DefaultGroup.class)
    @Size(max = 200, message = "公众号长度不能超过{max}位", groups = DefaultGroup.class)
    private String appId;
    /**
     * 公众号显示
     */
    @ExcelProperty(value = {EXCEL_TITLE, "公众号"})
    private String appIdDisplay;

    @Override
    public void freeData() {
        this.openid = null;
        this.subscribe = null;
        this.nickName = null;
        this.city = null;
        this.country = null;
        this.province = null;
        this.language = null;
        this.headImgUrl = null;
        this.subscribeTime = null;
        this.unionId = null;
        this.groupId = null;
        this.status = null;
        this.addTime = null;
        this.updateTime = null;
        this.sex = null;
        this.sexDisplay = null;
        this.sub = null;
        this.subDisplay = null;
        this.appId = null;
        this.appIdDisplay = null;
        super.freeData();
    }
}
